<template>
  <div>
    <el-button @click="save" type="primary">保存</el-button>
  </div>
</template>

<script>
const FileSaver = require('file-saver')
export default {
  name: 'FileSaver',
  methods: {
    save () {
      // 保存text文件
      var blob = new Blob(['Hello, world!'], { type: 'text/plain;charset=utf-8' })
      FileSaver.saveAs(blob, 'hello world.txt')
    }
  },
  created () {
  }
}
</script>

<style>

</style>
